<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            margin: auto;
            border: solid 1px;
            width: 300px;
            height: 200px;
            text-align: center;
            line-height: 200px;
            font-size: 50px;
            color: pink;
        }
        input{
            width: 98px;
            margin-top: 10px;

        }
        #btn1{
            margin-left: 864px;
        }
    </style>
</head>
<body>
    <div class="time">
        <span id="time">10</span>
    </div>
    <input type="button" id="btn1" value="开启">
    <input type="button" id="btn2" value="暂停">
    <input type="button" id="btn3" value="重置">

</body>
<script>
    var btn1 = document.getElementById('btn1')
    var btn2 = document.getElementById('btn2')
    var btn3 = document.getElementById('btn3')
    var time = document.getElementById('time')
    var a = time.innerText;
    
    var t;
    btn1.onclick = function(){
        clearInterval(t);
        t = setInterval(function(){
            time.innerText --;
            if(time.innerText == 0){
                clearInterval(t);
            }
        },1000)
    }
    btn2.onclick = function(){
        clearInterval(t);
    }
    btn3.onclick = function(){
        clearInterval(t);
        time.innerText = a;
    }
</script>
</html>